# -*- coding: utf-8 -*-
# Copyright 2011-2012 MagiCycles.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Django settings for MagiCycles project.

import os
from google.appengine.api import conf

#MagiCycles settings
DEFAULT_LANG = 'en-us'
DEFAULT_UNITS = 'metric'

APP_VERSION, CURRENT_CONFIG_VERSION, DEVELOPMENT = conf._inspect_environment()
DEBUG = DEVELOPMENT
TEMPLATE_DEBUG = DEBUG
if DEVELOPMENT:
    DEPOT_SITES = ["http://localhost:9090",]
    KML_SITES = ["http://localhost:9191",]
    ENABLE_ANONYMOUS_UPLOAD = True
    UPLOAD_PHOTO_LIMIT = 8*1024*1024  # 8M
    UPLOAD_KML_LIMIT = 8*1024*1024  # 8M
    USE_SAE = True
else:
    DEPOT_SITES = ["http://depot-01.magicycles.com",] #BlodStore Version
    KML_SITES = ["http://depot-02.magicycles.com",]
    ENABLE_ANONYMOUS_UPLOAD = False
    UPLOAD_PHOTO_LIMIT = 0.4*1024*1024  # 0.4M
    UPLOAD_KML_LIMIT = 1*1024*1024  # 1M
    USE_SAE = True

if os.environ.has_key("HTTP_HOST"):
    HOST_SITE = "http://%s"%(os.environ["HTTP_HOST"])
else:
    HOST_SITE = "http://%s%s"%(os.environ.get("SERVER_NAME",""),
                               os.environ.get("SERVER_PORT","80"))

ENABLE_POST_ACTIVITY = False

Site_Settings = {
    'development': DEVELOPMENT,
    'depot_site': DEPOT_SITES[0],
    'kml_site'  : KML_SITES[0],
    'host_site': HOST_SITE,
    'enable_anonymous_upload': ENABLE_ANONYMOUS_UPLOAD,
    'upload_photo_limit': UPLOAD_PHOTO_LIMIT,
    'upload_kml_limit': UPLOAD_KML_LIMIT,
    'enable_post_activity': ENABLE_POST_ACTIVITY,
    'post_activity_queue_url': "/queue/post_activity",
    }

# Django settings

ROOT_URLCONF = 'urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates".
    # Always use forward slashes, even on Windows.
    './templates',
    './localjs',
    )

MIDDLEWARE_CLASSES = (
    'google.appengine.ext.appstats.recording.AppstatsDjangoMiddleware',
    #'middleware.highlight.HighlightMiddleware',
    'lib.gaesessions.DjangoSessionMiddleware',
    'middleware.cc_cookies.MyCookiesMiddleware',
    )

INSTALLED_APPS = (
    'siteutils',
    'apis',
    'datastore',
    'oauth',
    'routes',
    'riders',
    )


def main():
    pass

if __name__ == '__main__':
    main()


